import request from '@/utils/request'

// 查询平台授权配置列表
export function listPlatform(query) {
  return request({
    url: '/fiscale/platform/list',
    method: 'get',
    params: query
  })
}

// 查询平台授权配置详细
export function getPlatform(configId) {
  return request({
    url: '/fiscale/platform/' + configId,
    method: 'get'
  })
}

// 查询平台类型列表
export function getPlatformTypes() {
  return request({
    url: '/fiscale/platform/types',
    method: 'get'
  })
}

// 根据平台类型获取配置字段
export function getPlatformConfigFields(typeCode) {
  return request({
    url: '/fiscale/platform/configFields/' + typeCode,
    method: 'get'
  })
}

// 新增平台授权配置
export function addPlatform(data) {
  return request({
    url: '/fiscale/platform',
    method: 'post',
    data: data
  })
}

// 修改平台授权配置
export function updatePlatform(data) {
  return request({
    url: '/fiscale/platform',
    method: 'put',
    data: data
  })
}

// 删除平台授权配置
export function delPlatform(configId) {
  return request({
    url: '/fiscale/platform/' + configId,
    method: 'delete'
  })
}

// 测试平台连接
export function testPlatformConnection(data) {
  return request({
    url: '/fiscale/platform/test',
    method: 'post',
    data: data
  })
}

// 同步平台数据
export function syncPlatformData(configId) {
  return request({
    url: '/fiscale/platform/sync/' + configId,
    method: 'post'
  })
}